Skip to content

docs(deploy): add native Ubuntu RA and TL setup - #136

Merged
csnitker-godaddy merged 3 commits into
fix/renewal-publicationfrom
docs/native-ubuntu-ra-tl
Oct 14, 2026
Merged

csnitker-godaddy merged 3 commits into
fix/renewal-publicationfrom
docs/native-ubuntu-ra-tl

Conversation

@csnitker-godaddy

@csnitker-godaddy csnitker-godaddy commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Add native Ubuntu RA/TL deployment with systemd, Caddy, OIDC, real DNS and
Let's Encrypt. Scripts install the Go line declared by go.mod, create
protected first-time configs, and register the RA public signing key through
the TL admin API without rewriting TL config or restarting it.

Document persistent state, monitoring, upgrades, the shared RA/TL administrator
trust boundary, and the remaining DNS-resealing limitation in ans-registry#66.
Require #135's same-origin Swagger and integrity attributes.

Installed on clean Ubuntu 24.04.5 arm64 with Go 1.26.8 and Caddy 2.11.6:
package installation, builds, config permissions/overwrite refusal, systemd
readiness, repeated bootstrap, and HTTPS proxy routing passed. Proxy HTTPS
used a local CA; public DNS/Let's Encrypt issuance and authenticated agent
lifecycle acceptance remain deployment-specific.

Depends on #128 and #135. Retarget to main after the runtime stack merges,
checking that parent commits do not reappear in the diff after squash merges.

Fixes #133.

AI assistance

Assisted-by: Codex (GPT-6), under Connor Snitker's direction.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The RA configuration creates a critical unresolved privilege boundary through its administrator-level TL API key.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Adds native Ubuntu deployment guidance and templates for ANS RA/TL using systemd, Caddy, OIDC, DNS, and Let's Encrypt.

Changes:

  • Adds Ubuntu installation and operational documentation.
  • Adds RA/TL configuration templates and systemd services.
  • Adds Caddy HTTPS routing and maintenance guidance.
File Summary Review notes
README.md Links to the Ubuntu deployment guide. —
deploy/​ubuntu/​tl.yaml Provides TL configuration and producer-key setup. —
deploy/​ubuntu/​README.md Documents installation, bootstrap, HTTPS, and maintenance. —
deploy/​ubuntu/​ra.yaml Provides production-oriented RA configuration. Critical: the RA process receives an administrator-level static TL API key.
deploy/​ubuntu/​install-packages.sh Installs Ubuntu, Caddy, and Go dependencies. —
deploy/​ubuntu/​Caddyfile Configures HTTPS and restricted public TL routes. —
deploy/​ubuntu/​ans-tl.service Defines the hardened TL systemd service. —
deploy/​ubuntu/​ans-ra.service Defines the hardened RA systemd service. —

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread deploy/ubuntu/ra.yaml
Comment on lines +42 to +45
tl-client:
base-url: "http://127.0.0.1:18081"
public-base-url: "https://tl.ans.example.com"
api-key: "__TL_SERVICE_KEY__"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guide now explicitly states that the RA holds an administrator-level TL credential and can change producer trust over loopback. The template assumes a shared RA/TL administrative boundary; Unix users and Caddy do not remove that authority. Deployments requiring separation need a least-privileged ingest authorization path before using this profile.

@kperry-godaddy kperry-godaddy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a real deployment path, not a sketch: the systemd units hold up under ProtectSystem=strict (StateDirectory stays writable), secrets land O_EXCL 0640 root:group, the Go tarball is checksum-verified, and the TL Caddy allowlist matches every read route the TL registers while blocking every ingest and admin route by both path and method. I also checked the config templates key by key against the loader at this base, including vlei.type: "off" and the https-only rule on tl-client.public-base-url, and the note about verify-dns on an ACTIVE registration is accurate.

The one thing I'd want before merge is the run the description says hasn't happened yet: one pass on a clean Ubuntu 24.04 VM, with the release recorded at the top of the README. A 260-line runbook with three programs in it earns that, and it would turn several of the notes below from reasoning into observation.

Six notes inline (three with suggestions you can commit as-is), and a few more below because they are about the PR rather than a line.

Not blocking, worth a look

  • "Fixes #133" won't auto-close from this base: GitHub only closes linked issues on merges into the default branch (https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue). The base is justified, since ca.validation.roots-file only exists in the #125-#128 stack, but the merge order needs a plan: a squash merge of #128 that deletes its branch retargets this PR to main with #128's commits in its diff.
  • Because /v2/admin/* is 404 through Caddy, the guide's smoke tests only work on the host. It would help to name what external monitoring should probe instead, for example GET /root-keys on the TL and GET /docs on the RA.
  • README lines 50-52 record a one-off build failure ("Go 1.27 failed the current linter's type checks") rather than the rule. "Build with the Go release named by the go directive in go.mod" says what an operator needs and won't read as stale when the linter moves.
  • no-store on the TL host also covers /tile/* and /checkpoint. The freshness argument in the comment fits the badge, status and audit reads under /v1/; is covering the tile path intended?
  • The unit hardening is solid as far as it goes. systemd-analyze security ans-ra will point at the rest: CapabilityBoundingSet=, ProtectClock, ProtectHostname, LockPersonality, RestrictRealtime, RestrictNamespaces, SystemCallFilter=@system-service, SystemCallArchitectures=native, PrivateDevices, ProtectProc=invisible.

Comment thread deploy/ubuntu/install-packages.sh Outdated
arm64) ans_arch=arm64 ;;
*) echo "Supported server architectures: amd64 and arm64" >&2; exit 1 ;;
esac
curl -fsSL --retry 3 'https://go.dev/dl/?mode=json' -o "$work/releases.json"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has a date on it. ?mode=json returns only the two newest release lines (today that is go1.27.1 and go1.26.8), so the day Go 1.28 ships, 1.26 drops out of the list, line 42 finds nothing, and the installer exits with "No supported Go 1.26 patch release found". include=all keeps the full index:

Suggested change
curl -fsSL --retry 3 'https://go.dev/dl/?mode=json' -o "$work/releases.json"
curl -fsSL --retry 3 'https://go.dev/dl/?mode=json&include=all' -o "$work/releases.json"

The .stable == true filter on line 42 still applies. Reading the line from the go directive in go.mod instead of hard-coding go1.26. would remove the second thing that has to move in lockstep.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The installer now reads the Go release line from go.mod and selects its latest stable patch from the complete include=all release index. The stale compiler/linter anecdote is removed.

Comment thread deploy/ubuntu/README.md Outdated
Comment on lines +157 to +178
sudo python3 - <<'PYTRUST'
from pathlib import Path
import yaml
ra = yaml.safe_load(Path('/etc/ans/ra.yaml').read_text())
p = Path('/etc/ans/tl.yaml')
tl = yaml.safe_load(p.read_text())
kid = ra['signer']['keyId']
entry = {
'raId': ra['signer']['raId'],
'keyId': kid,
'algorithm': 'ES256',
'publicKeyPem': (Path(ra['keys']['file']['path']) / (kid + '.pub')).read_text(),
}
existing = tl.setdefault('producerKeys', [])
matching = [e for e in existing if e['keyId'] == kid]
if matching and matching != [entry]:
raise SystemExit('Existing producer key differs; investigate before changing trust')
if not matching:
existing.append(entry)
p.write_text(yaml.safe_dump(tl, sort_keys=False))
print('RA public key configured for TL bootstrap.')
PYTRUST

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TL already has an API for this step: POST /internal/v1/producer-keys on 127.0.0.1, authenticated with the same generated service key (static auth is admin), and it is the mechanism this README recommends for later rotations. Using it here removes the YAML rewrite of /etc/ans/tl.yaml, the TL restart, and the config-schema knowledge this script hard-codes (signer.keyId, keys.file.path, the <keyId>.pub layout), all of which drift silently when the RA changes. Roughly:

sudo curl -fsS -X POST http://127.0.0.1:18081/internal/v1/producer-keys \
  -H "Authorization: Bearer $(sudo python3 -c 'import yaml;print(yaml.safe_load(open("/etc/ans/tl.yaml"))["auth"]["static"]["api-key"])')" \
  -H 'Content-Type: application/json' \
  -d "$(sudo jq -n --rawfile pem /var/lib/ans-ra/keys/ans-ra-example-signer.pub \
        '{key_id:"ans-ra-example-signer", ra_id:"ans-ra-example", algorithm:"ES256", public_key_pem:$pem,
          valid_from:(now|todate), expires_at:((now+315360000)|todate)}')"

Same thought for the config installer at lines 93-112: both programs would be easier to keep honest as deploy/ubuntu/install-config.sh and bootstrap-trust.sh, where shellcheck and a smoke test can reach them. Not a blocker for the guide; it is a maintenance point.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extracted install-config.sh and bootstrap-trust.sh. Bootstrap now uses the private producer-key API, verifies an existing identical active key, and requires no TL YAML rewrite or restart. The administrator secret is read from its protected config file; it is never placed in curl arguments or shell history, and requests cannot follow redirects or environment proxies.

Comment thread deploy/ubuntu/Caddyfile
# Keep operational endpoints accessible only through localhost.
@private path /v2/admin /v2/admin/*
respond @private 404
reverse_proxy 127.0.0.1:18080

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The verification section has operators paste an OIDC bearer token into the RA's Swagger UI, and this vhost serves /docs to the internet. The UI pulls its JavaScript from jsdelivr with no integrity hashes (that lives in docsui, not in this PR), so anyone able to tamper with that asset collects every token pasted into the page. The template can close that without touching the code, by keeping the docs off the public side:

	@docs {
		path /docs /docs/*
		not remote_ip 203.0.113.0/24
	}
	respond @docs 404

or by telling operators to reach the UI through an SSH tunnel to 127.0.0.1:18080. Worth doing before this becomes the recommended production shape.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Swagger assets in #135 now carry SHA-384 Subresource Integrity and crossorigin="anonymous", verified against both the pinned npm distribution and the served CDN bytes. The deployment guide requires that correction. An SSH tunnel alone would not stop a tampered third-party script from reading a bearer token.

Comment thread deploy/ubuntu/Caddyfile
ra.ans.example.com {
redir /docs/ /docs 308
# Keep authenticated API responses out of shared proxy caches.
header Cache-Control "no-store"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caddy doesn't send HSTS on its own, and both hosts are HTTPS-only with the redirect already in place, so the header is free here:

Suggested change
header Cache-Control "no-store"
header Cache-Control "no-store"
header Strict-Transport-Security "max-age=31536000; includeSubDomains"

Same line in the TL block (line 19).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added Strict-Transport-Security: max-age=31536000 to both virtual hosts. includeSubDomains is intentionally omitted because this template does not establish HTTPS policy for every descendant hostname.

Comment thread deploy/ubuntu/ra.yaml Outdated
auth:
type: oidc
oidc:
issuer-url: "https://YOUR_INSTANCE.clerk.accounts.dev"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#133 asks for templates operators adapt to their own identity provider; with a Clerk-shaped issuer here and the Clerk-only paragraph at README lines 28-32, the guide reads as if Clerk were required. A neutral placeholder keeps the template generic, and Clerk stays useful as the worked example in the prose:

Suggested change
issuer-url: "https://YOUR_INSTANCE.clerk.accounts.dev"
issuer-url: "https://issuer.example.com"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The template now uses https://issuer.example.com. The guide describes generic OIDC discovery/JWKS and audience requirements, with Clerk retained as an optional worked example.

Comment thread deploy/ubuntu/README.md Outdated
Comment on lines +255 to +257
before expiry. Post-renewal verification and sealing of changed DNS evidence
is not implemented: `verify-dns` on an ACTIVE registration currently returns
without refreshing its sealed DNS snapshot. Do not treat it as a DNS-update API.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accurate: VerifyDNS returns early on an ACTIVE registration and never touches the sealed snapshot. Right now this paragraph is the only place that limitation is written down, and a deploy guide is an easy place to lose it in a later edit. An issue to link from here would give it a home, and the paragraph can then shrink to one sentence.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linked the remaining post-renewal DNS resealing limitation to agentnameservice/ans-spec#66 and shortened the guide’s explanation. verify-dns on ACTIVE still does not refresh the sealed snapshot.

csnitker-godaddy added a commit that referenced this pull request Oct 2, 2026
Signed-off-by: Connor Snitker <csnitker@godaddy.com>
@csnitker-godaddy
csnitker-godaddy force-pushed the docs/native-ubuntu-ra-tl branch 2 times, most recently from 4847940 to e587e1e Compare October 5, 2026 21:18

@kperry-godaddy kperry-godaddy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Everything from the first pass landed, and the bootstrap rewrite came out better than what I sketched:

  • install-packages.sh now reads the release line from go.mod and takes the newest stable patch from the complete index. The default index only lists the two newest lines, so this is what keeps the installer working once 1.28 ships.
  • bootstrap-trust.sh goes through POST /internal/v1/producer-keys and the GET by key id, so there is no TL config rewrite and no restart. I checked the script against the handler: 200 on create, 409 on duplicate, and the fields it compares are the ones the response carries. The TL verifier reads the trust store on every ingest, so the key is live as soon as the call returns. Keeping the secret out of argv and refusing proxies and redirects are good touches.
  • HSTS on both hosts, no-store scoped to the /v1/ reads, the neutral issuer placeholder, the hardening directives, the monitoring probes, the recorded 24.04.5 run, and the merge-sequence section are all in.

On Swagger, pinning the assets with Subresource Integrity in #135 is the better fix; it stops a tampered script rather than limiting who can load the page. It does make this guide depend on #135 merging first, which the merge-sequence section already says.

Two follow-ups, not holding this up:

  • agentnameservice/ans-spec#66 is a spec question about live versus sealed TLSA records. It is a fair home for the DNS resealing gap, but nothing there mentions that verify-dns on an ACTIVE registration returns without touching the snapshot. A one-line comment on that issue, or a small tracking issue here, keeps the pointer from going stale.
  • The RA/TL trust-boundary paragraph is the right call for a single-host profile. When a least-privileged ingest credential exists, this template is the place to switch to it.

@csnitker-godaddy
csnitker-godaddy added this pull request to the merge queue Oct 8, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue because a pull request earlier in the stack was removed Oct 8, 2026
Signed-off-by: Connor Snitker <csnitker@godaddy.com>
Signed-off-by: Connor Snitker <csnitker@godaddy.com>
Signed-off-by: Connor Snitker <csnitker@godaddy.com>
@csnitker-godaddy
csnitker-godaddy force-pushed the docs/native-ubuntu-ra-tl branch from e587e1e to 3de914f Compare October 8, 2026 18:00
@csnitker-godaddy
csnitker-godaddy added this pull request to the merge queue Oct 14, 2026
Merged via the queue into main with commit 00b6d15 Oct 14, 2026
3 checks passed
@csnitker-godaddy
csnitker-godaddy deleted the docs/native-ubuntu-ra-tl branch October 14, 2026 20:52
@github-project-automation github-project-automation Bot moved this from Triage to Done in Agent Name Service Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Document native Ubuntu deployment for RA and TL

3 participants